package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ProductCategory;
import cn.wolfcode.crm.mapper.ProductCategoryMapper;
import cn.wolfcode.crm.service.IProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductCategoryServiceImpl implements IProductCategoryService{
    @Autowired
    private ProductCategoryMapper mapper;
    public void save(ProductCategory entity) {
        mapper.insert(entity);
    }

    public void update(ProductCategory entity) {
        mapper.updateByPrimaryKey(entity);
    }

    public void delete(Long id) {
        mapper.deleteByPrimaryKey(id);
    }

    public ProductCategory get(Long id) {
        return mapper.selectByPrimaryKey(id);
    }


    public List<ProductCategory> getAll() {
        return mapper.selectAll();
    }

    public List<ProductCategory> query(Long parentId) {
        return mapper.query(parentId);
    }

}
